import {cbs} from '../../../../config/settings.js';

module.exports = {
	data() {
		return  {
			tableData: [],
			total: 0,
			size: 5,
			page: 1,
			isFinish: false
		}
	},
	methods: {
		getList(flag=false){
			let data = this.$$formData({
				pageNum: this.page,
				size: this.size,
				flag: !!flag
			})
			this.$$api_order_list(data, res => {
				if(res.event === 0) {
					this.tableData = res.obj;
					this.total = res.maxCount;
				}else {
					cbs.submitError.call(this, `获取订单信息失败，${res.msg}`);
				}
			})
		},
		handleCurrentChange(val=1) {
			this.page = val;
			this.getList(this.isFinish);
		},
		changeList(flag) {
			this.isFinish = flag;
			this.handleCurrentChange(1);
		}
	},
	created() {
		this.getList(false);
	},
}